<template>
  <div class="">
    <header class="flex disfx">
      <div class="flexl">
        叩丁狼商品管理系统
        <span @click="setml">🦄</span>
      </div>
      <div>
        <div class="flexr" @click="changeisshow">
          admin
          <span @click="loginin">💓</span>
        </div>
        <ul
          data-v-49453692=""
          class="el-dropdown-menu el-popper"
          id="dropdown-menu-5660"
          style="
            transform-origin: center top;
            z-index: 2009;
            position: absolute;
            top: 44px;
            left: 1800px;
          "
          x-placement="bottom-end"
          v-show="isshow"
        >
          <li
            @click="logout"
            data-v-49453692=""
            tabindex="-1"
            class="el-dropdown-menu__item"
          >
            <!---->退出登录
          </li>
          <div x-arrow="" class="popper__arrow" style="left: 57.8438px"></div>
        </ul>
      </div>
    </header>

    <el-menu
      default-active="1-4-1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :collapse="$store.state.ml"
      :unique-opened="true"
      background-color="#324157"
      text-color="#BFCBD9"
      style="height: 100vh; position: fixed; top: 0; left: 0; margin-top: 70px"
      :router="label"
    >
      <el-submenu index="commodity">
        <template slot="title">
          <i class="el-icon-s-tools icolor"></i>
          <span slot="title">商品管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="list">商品列表</el-menu-item>
          <el-menu-item index="classification">商品分类</el-menu-item>
          <el-menu-item index="brand">品牌管理</el-menu-item>
          <el-menu-item index="attribute">商品属性管理</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-s-management icolor"></i>
          <span slot="title">订单中心</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="1-1">订单列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-service icolor"></i>
          <span slot="title">店铺运营</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="1-1">专题管理</el-menu-item>
          <el-menu-item index="1-2">运营数据</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>
 
<script>
import About from "./List.vue";
export default {
  data() {
    return {
      isshow: false,
      isCollapse: true,
      // label1: false,
      label: true,
    };
  },
  created() {
    this.$store.state.ml = false;
    this.$router.push("/login");
  },

  methods: {
    logout() {
      if (!confirm("确定要退出？")) return;

      this.$router.push("/login");
    },
    loginin() {
      this.$router.push("/login");
    },
    falg() {
      console.log(1);
      this.label = !this.label;
    },
    setml() {
      this.$store.commit("setml");
    },
    changeisshow(e) {
      this.isshow = !this.isshow;
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  components: {
    About,
  },
};
</script>
 
<style lang = "less" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
.content {
  margin-top: 70px;
}
header {
  height: 70px;
  line-height: 70px;
  background-color: #409eff;
  padding: 0 15px;
}
.icolor {
  color: #bfcbd9;
}
* {
  padding: 0;
  margin: 0;
  list-style: none;
}
.disfx {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}
.flex {
  display: flex;
  justify-content: space-between;
}
.flexl {
  font-size: 20px;
  color: #fff;
}
.flexr {
  font-size: 14px;
  color: #fff;
  cursor: pointer;
}
</style>